package com.wzdigit.wms.wms.strategy.webservice.handle;
/*
 * @Author:yangwenbiao
 * @Date 2021/3/17 8:46 AM
 * @version 1.0
 */

import com.wzdigit.wms.basic.domain.mid.IfPostback;
import com.wzdigit.wms.basic.enums.writeback.TopicEnum;
import com.wzdigit.wms.wms.strategy.webservice.iservice.ISendWebService;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class SendWebServiceHandle {

    private static Map<TopicEnum, ISendWebService> sendWebServiceMap = new HashMap<>();

    /**
     * 发送webservice请求，每个发送请求类都实现:{@link com.wzdigit.wms.wms.strategy.webservice.iservice.ISendWebService}
     * @param topicEnum
     * @return
     */
    public Object send(TopicEnum topicEnum, IfPostback ifPostback) {
        return sendWebServiceMap.get(topicEnum).send(ifPostback);
    }

    public static void push(TopicEnum topicEnum,ISendWebService value) {
        sendWebServiceMap.put(topicEnum, value);
    }

}
